package com.wjq.entity;


import com.wjq.DTO.ChoiceDTO;
import lombok.Data;
import org.springframework.data.annotation.Id;

import java.util.List;

public class ChoiceQuestion extends Question {

    @Id
    private Integer id;

    private Integer multiSelect;

    private String description;

    private Integer questionnaireId;

    private List<Choice> choices;

    private List<String> options;

    private String type;

    private Integer isMandatory = 1;

    public static final String RADIO = "radio";
    public static final String CHECKBOX = "checkbox";


    public ChoiceQuestion(){
        super();
    }

    public ChoiceQuestion(Integer serial_num,Integer id,Integer multi_select,String description,Integer questionnaire_id) {
        super(serial_num);
        this.isMandatory = 1;
        this.id = id;
        this.multiSelect = multi_select;
        this.description = description;
        this.questionnaireId = questionnaire_id;
        if(multiSelect == 0) {
            this.type=RADIO;
        } else {
            this.type=CHECKBOX;
        }
    }

    public Integer getIsMandatory() {
        return isMandatory;
    }

    public void setIsMandatory(Integer isMandatory) {
        this.isMandatory = isMandatory;
    }

    public List<String> getOptions() {
        return options;
    }

    public void setOptions(List<String> options) {
        this.options = options;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getMultiSelect() {
        return multiSelect;
    }

    public void setMultiSelect(Integer multiSelect) {
        this.multiSelect = multiSelect;
        if(multiSelect == 0) {
            this.type=RADIO;
        } else {
            this.type=CHECKBOX;
        }
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getQuestionnaireId() {
        return questionnaireId;
    }

    public void setQuestionnaireId(Integer questionnaireId) {
        this.questionnaireId = questionnaireId;
    }

    public List<Choice> getChoices() {
        return choices;
    }

    public void setChoices(List<Choice> choices) {
        this.choices = choices;
    }

    public String getType() {
        return type;
    }

    public void setType(String questionType) {
        this.type = questionType;
    }

    @Override
    public String toString() {
        return "ChoiceQuestion{" +
                "id=" + id +
                ", multiSelect=" + multiSelect +
                ", description='" + description + '\'' +
                ", questionnaireId=" + questionnaireId +
                ", choices=" + choices +
                ", options=" + options +
                ", type='" + type + '\'' +
                ", serialNum=" + serialNum +
                '}';
    }
}
